package com.onec.service.netty.coder;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;
import java.util.List;

/**
 * 加密器的 使用
 */
public class StringIntegerEncoder extends MessageToMessageEncoder<String> {


  @Override
  protected void encode(ChannelHandlerContext ctx, String msg, List<Object> out) throws Exception {
    char[] chars = msg.toCharArray();
    for (char a : chars) {
      if (a >= 48 && a <= 57) {
        out.add((int) a);
      }
    }
  }
}
